package com.permission.model;

import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.solution.framework.model.BaseBean;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;

/**
 * Created with generator tools.
 * User: sunguangzhu
 * DateTime:2014-05-07 01:19:05
 */
@Entity
@Table(name = "t_per_role_resource")
public class PerRoleResource extends BaseBean implements java.io.Serializable {
    /**
     * 归属角色
     */
    private com.permission.model.PerRole perRole;

    /**
     * 归属资源
     */
    private com.permission.model.PerResource perResource;

    /**
     * default constructor
     */
    public PerRoleResource() {
    }

    /**
     * full constructor
     *
     * @param perRole
     * @param perResource
     */
    public PerRoleResource(com.permission.model.PerRole perRole, com.permission.model.PerResource perResource) {
        this.perRole = perRole;
        this.perResource = perResource;
    }

    /**
     * getter
     */
    @JsonManagedReference
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "perRole_id")
    @NotFound(action = NotFoundAction.IGNORE)
    @ForeignKey(name = "fk_perroleresource_perRole")
    public com.permission.model.PerRole getPerRole() {
        return this.perRole;
    }

    /**
     * setter
     *
     * @param perRole
     */
    public void setPerRole(com.permission.model.PerRole perRole) {
        this.perRole = perRole;
    }

    /**
     * getter
     */
    @JsonManagedReference
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "perResource_id")
    @NotFound(action = NotFoundAction.IGNORE)
    @ForeignKey(name = "fk_perroleresource_perResource")
    public com.permission.model.PerResource getPerResource() {
        return this.perResource;
    }

    /**
     * setter
     *
     * @param perResource
     */
    public void setPerResource(com.permission.model.PerResource perResource) {
        this.perResource = perResource;
    }

}
